﻿package com.scn.base.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.scn.base.dao.impl.DAOManager;
import com.scn.base.domain.RolePowerVO;
import com.scn.base.service.ISysRolePowerService;
@Service
public class SysRolePowerServiceImpl implements ISysRolePowerService {
	@Autowired
	private DAOManager daoManager;
	public void insertRolePowers1(List powerList,int srid) {
		if(powerList==null||powerList.size()==0){
			return;
		}
		for(Object o:powerList){
			RolePowerVO rolePower=(RolePowerVO)o;
			rolePower.setSrid(srid);
			daoManager.getSysRolePowerDao().insertRolePower((rolePower));;
		}
	}
	//删除后再添加
	public void deleteAndinsertRolePowers(List powerList,int srid) {
		if(powerList==null||powerList.size()==0){
			return;
		}
		daoManager.getSysRolePowerDao().deleteRolePowerByRole(srid);
		for(Object o:powerList){
			daoManager.getSysRolePowerDao().insertRolePower((RolePowerVO)o);
		}

	}
	
	
	public List<RolePowerVO> selectRolePowerBySrIdList1(int srid) {
		return daoManager.getSysRolePowerDao().selectRolePowerBySrIdList(srid);
	}
	
	//删除权限
	public void deleteRolePowerByRole(int srid) {
		 daoManager.getSysRolePowerDao().deleteRolePowerByRole(srid);
	}
	//修改复制组功能
	public void updateRolePower(Map srid) {
		daoManager.getSysRolePowerDao().updateRolePower(srid);
	}


}
